// https://leetcode.cn/problems/make-array-zero-by-subtracting-equal-amounts/description/

import "sort"
func minimumOperations(nums []int) int {
    sort.Ints(nums)
	t, i, ans := 0, 0, 0
	for i < len(nums) {
		for i < len(nums) && nums[i] - t == 0 {
			i++
		}
		if i < len(nums) {
			t += nums[i] - t
			ans += 1
		}
		i++
	}
	return ans
}